﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Estadistica.aspx.cs" Inherits="ent_pm.Estadisticas.DosVariables.Estadistica" %>

<%@ Register Assembly="System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    Namespace="System.Web.UI.DataVisualization.Charting" TagPrefix="asp" %>
<%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Estasdisticas</title>
</head>
<body>
    <form id="form1" runat="server">
    <ext:ScriptManager runat="server" Theme="Gray">
    </ext:ScriptManager>
    <ext:Store ID="storeOpcionDatos" runat="server">
        <Reader>
            <ext:JsonReader ReaderID="Id">
                <Fields>
                    <ext:RecordField Name="Id" />
                    <ext:RecordField Name="Codigo" />
                    <ext:RecordField Name="Campo" />
                    <ext:RecordField Name="Descripcion" />
                </Fields>
            </ext:JsonReader>
        </Reader>
    </ext:Store>
    <ext:Store ID="storeDatos" runat="server" GroupField="Valor">
        <Reader>
            <ext:JsonReader>
                <Fields>
                    <ext:RecordField Name="NumeroProyectos" />
                    <ext:RecordField Name="InversionTotal" />
                    <ext:RecordField Name="AportePlan" />
                    <ext:RecordField Name="AporteContraparte1" />
                    <ext:RecordField Name="AporteContraparte2" />
                    <ext:RecordField Name="Valor" />
                    <ext:RecordField Name="ValorId" />
                    <ext:RecordField Name="Nombre" />
                    <ext:RecordField Name="Canton" />
                    <ext:RecordField Name="Parroquia" />
                </Fields>
            </ext:JsonReader>
        </Reader>
    </ext:Store>
    <ext:Store ID="storeTipo" runat="server">
        <Reader>
            <ext:JsonReader ReaderID="Key">
                <Fields>
                    <ext:RecordField Name="Value">
                    </ext:RecordField>
                    <ext:RecordField Name="Key">
                    </ext:RecordField>
                </Fields>
            </ext:JsonReader>
        </Reader>
    </ext:Store>

    <script type="text/javascript" language="javascript">
    var saveData = function () {
            <%= GridData.ClientID%>.setValue(Ext.encode(<%= GridPanel1.ClientID%>.getRowsValues(false)));
        }
    </script>

    <ext:Hidden ID="GridData" runat="server" />
    <ext:Panel runat="server" Border="false" BodyStyle="padding:15px:">
        <Body>
            <ext:ColumnLayout runat="server">
                <ext:LayoutColumn ColumnWidth="0.8">
                    <ext:Panel runat="server" Border="false">
                        <Body>
                            <ext:FormLayout runat="server">
                                <ext:Anchor Horizontal="95%">
                                    <ext:Panel ID="Panel3" runat="server" Border="false">
                                        <Body>
                                            <asp:Chart ID="Chart1" runat="server" Width="650px" Height="360px" BorderColor="#B54001"
                                                BorderDashStyle="Solid" BackGradientStyle="DiagonalLeft" BorderWidth="2px" BackColor="LightSalmon"
                                                ImageLocation="~\TempImages\ChartPic_#SEQ(300,3)">
                                                <Titles>
                                                    <asp:Title ShadowColor="32, 0, 0, 0" Font="Trebuchet MS, 14.25pt, style=Bold" ShadowOffset="3"
                                                        Text="" Alignment="TopLeft" ForeColor="26, 59, 105">
                                                    </asp:Title>
                                                </Titles>
                                                <Legends>
                                                    <asp:Legend Enabled="true" IsTextAutoFit="False" Name="Default" BackColor="Transparent"
                                                        Font="Trebuchet MS, 8.25pt, style=Bold" >
                                                        <Position Auto="false" X="1" Y="95" Height="9" Width="99" />
                                                        
                                                    </asp:Legend>
                                                </Legends>
                                                <BorderSkin SkinStyle="Emboss"></BorderSkin>
                                                <Series>
                                                    <asp:Series ChartArea="ChartArea1" Name="Series1" BorderColor="180, 26, 59, 105"
                                                        Color="224, 64, 10" IsVisibleInLegend="false" LegendText="Inversión">
                                                    </asp:Series>
                                                    <asp:Series ChartArea="ChartArea1" Name="Series2" BorderColor="180, 26, 59, 105"
                                                        Color="Blue" IsVisibleInLegend="false" Enabled="false" LegendText="Número Proyectos" >
                                                    </asp:Series>
                                                    <asp:Series ChartArea="ChartArea1" Name="Series3" BorderColor="180, 26, 59, 105"
                                                        Color="Green" IsVisibleInLegend="false" Enabled="false" LegendText="Aporte Plan">
                                                    </asp:Series>
                                                    <asp:Series ChartArea="ChartArea1" Name="Series4" BorderColor="180, 26, 59, 105"
                                                        Color="Orange" IsVisibleInLegend="false" Enabled="false" LegendText="Aporte Contraparte 1">
                                                    </asp:Series>
                                                    <asp:Series ChartArea="ChartArea1" Name="Series5" BorderColor="180, 26, 59, 105"
                                                        Color="Yellow" IsVisibleInLegend="false" Enabled="false" LegendText="Aporte Contraparte 2">
                                                    </asp:Series>
                                                </Series>
                                                <ChartAreas>
                                                    <asp:ChartArea Name="ChartArea1" BorderColor="64, 64, 64, 64" BorderDashStyle="Solid"
                                                        BackSecondaryColor="White" BackColor="OldLace" ShadowColor="Transparent" BackGradientStyle="TopBottom">
                                                        <Area3DStyle Rotation="10" Perspective="10" Inclination="15" IsRightAngleAxes="False"
                                                            WallWidth="0" IsClustered="False"></Area3DStyle>
                                                        <AxisY LineColor="64, 64, 64, 64" IsLabelAutoFit="False">
                                                            <LabelStyle Font="Trebuchet MS, 8.25pt, style=Bold" />
                                                            <MajorGrid LineColor="64, 64, 64, 64" />
                                                        </AxisY>
                                                        <AxisX LineColor="64, 64, 64, 64" IsLabelAutoFit="False">
                                                            <LabelStyle Font="Trebuchet MS, 8.25pt, style=Bold" />
                                                            <MajorGrid LineColor="64, 64, 64, 64" />
                                                        </AxisX>
                                                    </asp:ChartArea>
                                                </ChartAreas>
                                            </asp:Chart>
                                        </Body>
                                    </ext:Panel>
                                </ext:Anchor>
                            </ext:FormLayout>
                        </Body>
                    </ext:Panel>
                </ext:LayoutColumn>
                <ext:LayoutColumn ColumnWidth="0.2">
                    <ext:Panel ID="Panel2" runat="server" Border="false" ButtonAlign="Center">
                        <Body>
                            <ext:FormLayout ID="FormLayout1" runat="server" LabelAlign="Top">
                                <ext:Anchor Horizontal="95%">
                                    <ext:ComboBox Editable="false" FieldLabel="Tipo" ID="cbxCategorias" StoreID="StoreTipo"
                                        runat="server" DisplayField="Value" ValueField="Key" TypeAhead="true" ForceSelection="true"
                                        TriggerAction="All" Grow="true" GrowMax="300" EmptyText="Seleccione" SelectOnFocus="true"
                                        AutoDataBind="True" Hidden="true">
                                    </ext:ComboBox>
                                </ext:Anchor>
                                <ext:Anchor Horizontal="95%">
                                    <ext:ComboBox ID="cbxOpcionDatos" runat="server" StoreID="storeOpcionDatos" DisplayField="Descripcion"
                                        ValueField="Campo" Editable="false" FieldLabel="Variable a Medir" AllowBlank="false"
                                        EmptyText="Seleccione">
                                        <Listeners>
                                            <Valid Handler="#{btnVerGrafica}.enable();" />
                                            <Invalid Handler="#{btnVerGrafica}.disable();" />
                                        </Listeners>
                                    </ext:ComboBox>
                                </ext:Anchor>
                                <ext:Anchor>
                                    <ext:CheckboxGroup ID="ckgOpcionDatosMostrar" AutoDataBind="true" FieldLabel="Datos a Mostrar"
                                        runat="server" ColumnsNumber="1" Vertical="true">
                                        <Items>
                                            <ext:Checkbox ID="chkOpc2" runat="server" BoxLabel="Número Proyectos" >
                                            </ext:Checkbox>
                                            <ext:Checkbox ID="chkOpc1" runat="server" BoxLabel="Inversión Total" Checked="true">
                                            </ext:Checkbox>
                                            <ext:Checkbox ID="chkOpc3" runat="server" BoxLabel="Aporte Plan">
                                            </ext:Checkbox>
                                            <ext:Checkbox ID="chkOpc4" runat="server" BoxLabel="Aporte Contraparte 1">
                                            </ext:Checkbox>
                                            <ext:Checkbox ID="chkOpc5" runat="server" BoxLabel="Aporte Contraparte 2">
                                            </ext:Checkbox>
                                        </Items>
                                    </ext:CheckboxGroup>
                                </ext:Anchor>
                            </ext:FormLayout>
                        </Body>
                        <Buttons>
                            <ext:Button ID="btnVerGrafica" Enabled="false" runat="server" AutoPostBack="true"
                                Text="Ver Grafica" OnClick="VerGrafica_Click">
                            </ext:Button>
                        </Buttons>
                    </ext:Panel>
                </ext:LayoutColumn>
            </ext:ColumnLayout>
        </Body>
    </ext:Panel>
    <ext:GridPanel Hidden="true" ID="gdpDatos" runat="server" StoreID="storeDatos" Title="Datos"
        AutoHeight="true" AutoExpandColumn="Valor">
        <ColumnModel runat="server">
            <Columns>
                <ext:Column Header="Número de Proyectos" DataIndex="NumeroProyectos" Width="120">
                </ext:Column>
                <ext:Column Header="Inversión Total" Align="Right" DataIndex="InversionTotal" Width="150">
                    <Renderer Format="UsMoney" />
                </ext:Column>
                <ext:Column Header="Aporte Plan" Align="Right" DataIndex="AportePlan" Width="150">
                    <Renderer Format="UsMoney" />
                </ext:Column>
                <ext:Column Header="Aporte Contraparte 1" Align="Right" DataIndex="AporteContraparte1"
                    Width="150">
                    <Renderer Format="UsMoney" />
                </ext:Column>
                <ext:Column Header="Aporte Contraparte 2" Align="Right" DataIndex="AporteContraparte2"
                    Width="150">
                    <Renderer Format="UsMoney" />
                </ext:Column>
                <ext:Column ColumnID="Valor" Header="Variable" DataIndex="Valor" Width="150">
                </ext:Column>
            </Columns>
        </ColumnModel>
    </ext:GridPanel>
    <ext:GridPanel ID="GridPanel1" runat="server" StoreID="storeDatos" Title="Datos"
        AutoHeight="true" AutoExpandColumn="Nombre">
        <TopBar>
            <ext:Toolbar ID="Toolbar1" runat="server" AutoWidth="true">
                <Items>
                    <ext:Label ID="Label1" runat="server" Text="Información de Proyectos">
                    </ext:Label>
                    <ext:ToolbarFill ID="ToolbarFill1" runat="server">
                    </ext:ToolbarFill>
                    <ext:Button ID="Button3" runat="server" Text="Exportar a Excel" AutoPostBack="true"
                        OnClick="ToExcel" Icon="PageExcel">
                        <Listeners>
                            <Click Fn="saveData" />
                        </Listeners>
                    </ext:Button>
                </Items>
            </ext:Toolbar>
        </TopBar>
        <ColumnModel ID="ColumnModel1" runat="server">
            <Columns>
                <ext:Column ColumnID="Valor" Header="Variable" DataIndex="Valor" Width="80" Hidden="true">
                </ext:Column>
                <ext:GroupingSummaryColumn ColumnID="Nombre" Width="200" Header="Nombre" DataIndex="Nombre"
                    SummaryType="None">
                </ext:GroupingSummaryColumn>
                <ext:GroupingSummaryColumn Header="Cantón" DataIndex="Canton" SummaryType="None"
                    Width="90">
                </ext:GroupingSummaryColumn>
                <ext:GroupingSummaryColumn Header="Parroquia" DataIndex="Parroquia" SummaryType="None"
                    Width="90">
                </ext:GroupingSummaryColumn>
                <ext:GroupingSummaryColumn Header="Número" DataIndex="NumeroProyectos" Width="40"
                    SummaryType="Sum">
                </ext:GroupingSummaryColumn>
                <ext:GroupingSummaryColumn Header="Aporte Plan" Align="Right" DataIndex="AportePlan"
                    Width="130" SummaryType="Sum">
                    <Renderer Format="UsMoney" />
                </ext:GroupingSummaryColumn>
                <ext:GroupingSummaryColumn Header="Aporte Contraparte 1" Align="Right" DataIndex="AporteContraparte1"
                    Width="130" SummaryType="Sum">
                    <Renderer Format="UsMoney" />
                </ext:GroupingSummaryColumn>
                <ext:GroupingSummaryColumn Header="Aporte Contraparte 2" Align="Right" DataIndex="AporteContraparte2"
                    Width="130" SummaryType="Sum">
                    <Renderer Format="UsMoney" />
                </ext:GroupingSummaryColumn>
                <ext:GroupingSummaryColumn Header="Inversión Total" Align="Right" DataIndex="InversionTotal"
                    Width="130" SummaryType="Sum">
                    <Renderer Format="UsMoney" />
                </ext:GroupingSummaryColumn>
            </Columns>
        </ColumnModel>
        <View>
            <ext:GroupingView ID="GroupingView1" runat="server" />
        </View>
        <Plugins>
            <ext:GroupingSummary ID="GroupingSummary1" runat="server" />
        </Plugins>
    </ext:GridPanel>
    </form>
</body>
</html>
